import later from 'later';
import r from '../db';


const todos = [
  'a3',
  'a4',
  'a5'
];

const createRandomTodo = () => {
  const rand = Math.round(Math.random() * todos.length - 1, 0);
  r.table('todos').insert({ text: todos[rand] }).run();
};

const every2minutes = later.parse.text('every 2 minutes');

later.setInterval(createRandomTodo, every2minutes);
